﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace CodeStandardAddin.View
{
	public class ConfigControl : UserControl
	{
		#region Field ---------------------------------------------------------------------------------

		protected string _configText = "";
		protected bool _hasChanged = false;

		#endregion Field ------------------------------------------------------------------------------


		#region Method --------------------------------------------------------------------------------

		public string GetCurrentConfigText()
		{
			return "";
		}

		public bool SetConfigText(string configText)
		{
			_configText = configText;
			_hasChanged = false;
			return true;
		}

		public bool ApplyConfig()
		{
			return true;
		}

		#endregion Method -----------------------------------------------------------------------------


		#region Event ---------------------------------------------------------------------------------

		public event EventHandler ConfigChanged = null;
		protected virtual void OnConfigChanged()
		{
			_hasChanged = _configText != this.GetCurrentConfigText();
			if (ConfigChanged != null) ConfigChanged(this, EventArgs.Empty);
		}

		#endregion Event ------------------------------------------------------------------------------
	}
}